home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / BSP Tree Demo / source / initapp.cp < prev    next >
Encoding:
Text File  |  1995-04-06  |  1.2 KB  |  40 lines  |  [TEXT/MMCC]

  1. #include    "core.h"
  2. #include    "view.h"
  3. #include    "cube.h"
  4. #include    "bsptree_3d.h"
  5. #include    "transform_3d.h"
  6.  
  7. bsptree    *world;
  8. void    main (void)
  9. {
  10.     core_main ();
  11. }
  12.  
  13. void    InitializeApplication (void)
  14. {
  15.     //    make the scene to display
  16.     world = new bsptree;
  17.     world->Insert (Cube (IDENTITY_MATRIX), OUT, OUT);
  18.     world->Insert (Cube (Scale (R(-1.0), R(-0.75), R(-1.25)) * Translate (R(0.25), R(0.0), R(0.0))), IN, OUT);
  19.     world->Reduce ();
  20.     world->Insert (Cube (Scale (R(0.5), R(0.75), R(0.5)) * RotateY (R(15.0)) * Translate (R(0.25), R(0.75), R(0.0))), OUT, OUT);
  21.     world->Reduce ();
  22.     
  23.     //    make the display window
  24.     window *w = new window (2000, 0);
  25.     w->SetAspectRatio (1, 1);
  26.     Rect    c1 = {kTop, kLeft, kBottom, kRight}, c2 = {0, 0, 0, 0}, 
  27.                 c3 = {kTop, kLeft, kTop, kLeft}, c4 = {7, 7, 103, 63},
  28.                 c7 = {kTop, kLeft, kBottom, kRight}, c8 = {20, 20, -20, -20},
  29.                 c9 = {kTop, kLeft, kBottom, kRight}, c10 = {1, 1, -1, -1},
  30.                 b1 = {10, 10, 30, 60}, b2 = {32, 10, 52, 60},
  31.                 b3 = {54, 10, 76, 60}, b4 = {78, 10, 100, 60};
  32.     bound3d    *b = new bound3d (c1, c2),
  33.                 *gbound3 = new bound3d (c7, c8, FALSE);
  34.     bound    *gbound = new bound (c9, c10);
  35.     view    *vw = new view (w);
  36.     gbound->AddChild (vw);
  37.     gbound3->AddChild (gbound);
  38.     b->AddChild (gbound3);
  39.     w->AddChild (b);
  40. }